package org.wk.affiliate.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.wk.affiliate.domain.NoticeManage;
import org.wk.core.db.dao.GenericJpaRepository;

/**
 * @author TangShenShen
 * @Description: 公告dao层
 * @date 2018/6/814:47
 */
public interface NoticeDao extends GenericJpaRepository<NoticeManage, String> {
    /**
     * 手机端公告列表   已发布的  按时间倒序
     * @author TangShenShen
     * @date 2018/6/9 10:48
     */
    Page<NoticeManage> findByNoticeStatusCode(String noticeStatusCode, Pageable pageRequest);

    @Query(nativeQuery = true,value = "SELECT * from j_notice_manage ORDER BY modify_time desc LIMIT 0,1")
    NoticeManage getNewNotice();
}
